#!/bin/sh

echo "Susan uninstaller"
echo
echo "If you continue this program, Susan and all of its configuration will"
echo "be removed from this system."
echo "Press Ctrl-C to cancel or press Enter to continue deinstallation."
read

# Remove startup item
echo "* Susan startup item... "
if [ -f /Library/LaunchDaemons/com.susan.susan-fd.plist ]; then
	sudo launchctl unload /Library/LaunchDaemons/com.susan.susan-fd.plist
	sudo rm /Library/LaunchDaemons/com.susan.susan-fd.plist
	echo "  + removed successfully"
else
  echo "  - not found, nothing to remove"
fi

echo "* Susan file daemon... "
if [ -d "/usr/local/susan" ]; then
  sudo rm -r "/usr/local/susan"
	echo "  + removed successfully"
else
  echo "  - not found, nothing to remove"
fi

echo "* Installer receipt... "
sudo pkgutil --forget com.susan.skyatlas.netmon
sudo pkgutil --forget com.susan.susan.filedaemon
sudo pkgutil --forget com.susan.susan.bconsole
